package com.beans;

//3.Setter注入
// 通过@Autowired实现Setter注入

import org.springframework.stereotype.Controller;

import javax.annotation.Resource;

@Controller
public class UserController3 {
    private UserService userService;


//    @Autowired和@Autowired都能实现Setter注入
//    @Autowired
    @Resource
    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    public void sayHi() {
        userService.sayHi();
        //hello UserService
    }

}
